﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.MODEL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.DALFactory;

namespace KPIS.GERP.GHRMS.BLL
{
    public class EmployeeTypeBLL : IEmployeeTypeBLL
    {
        private static readonly IEmployeeTypeDAL dal = DataAccess.CreateEmployeeTypes();

        public IList<EmployeeTypeInfo> Select2()
        {
            return dal.ListEmployeeTypes(new EmployeeTypeInfo(0));
        }
        public IList<EmployeeTypeInfo> ListEmployeeTypes()
        {
            return dal.ListEmployeeTypes(new EmployeeTypeInfo(0));
        }
        public IList<EmployeeTypeInfo> ListEmployeeTypes(Nullable<int> Sequence)
        {
            int Seq = Sequence == null ? 0 : (int) Sequence;
            return dal.ListEmployeeTypes(new EmployeeTypeInfo(Seq));
        }
        public void Insert(string Name, string Remarks, int CreatedBy)
        {
            try
            {
                dal.Insert(new EmployeeTypeInfo(0, Name, Remarks, CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, string Remarks, int UpdatedBy)
        {
            try
            {
                dal.Update(new EmployeeTypeInfo(Sequence, Name, Remarks, 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                dal.Delete(new EmployeeTypeInfo(Sequence, "", "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }        
        
    }
}
